﻿using UnityEngine;
using System.Collections;

public class NextLevelScript : MonoBehaviour {
    LevelManager map;
    Transform Player;
    void Start() {
        map = GameObject.FindGameObjectWithTag("GameManager").GetComponent<LevelManager>();
        Player = GameObject.FindGameObjectWithTag("Player").transform;
    }
    void FixedUpdate()
    {
        if (Vector3.Distance(Player.position,transform.position) < 0.5f)
        {
            map.ReGenerateMap();
        }
    }
}
